#!/usr/bin/env python

def init ( l, admin = 0 ):
	from liwe import parts
	from download_manager_class import DownloadManager

	DownloadManager ( l )

 	parts.add ( l.layman, "ext" )
 	parts.add_wwl ( l.layman, "tree" )

	l.layman.add_js ( "modules/download_manager/js/download_manager.js" )
	l.layman.add_css ( "modules/download_manager/gfx/download_manager.css" )

	l.layman.add_js_code ( "download_manager.init ();" )

	if admin and int ( admin ):
		parts.add ( l.layman, [ "form", "ext", "cookie" ] )
		parts.add_wwl ( l.layman, [ "uploader" ] )

		l.layman.add_css ( "modules/download_manager/gfx/download_manager.admin.css" )
		l.layman.add_js ( "modules/download_manager/js/download_manager.admin.js" )

		l.layman.add_js_code ( "download_manager.admin.init ();" )

	return ''
